Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mutaby used async function argument in closure for needless_pass_by_ref_mut #11492

Merged
merged 2 commits into from
Sep 20, 2023

Conversation

GuillaumeGomez
Copy link
Member

Fixes #11380.

The problem was that it needed to go through closures as well in async functions to correctly find the mutable usage of async function arguments.

changelog: Correctly handle mutable usage of async function arguments in closures.

r? @Centri3

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 13, 2023
@GuillaumeGomez GuillaumeGomez changed the title Add regression test for mutaby used asyncfunction argument in returned closure for needless_pass_by_ref_mut Fix mutaby used async function argument in closure for needless_pass_by_ref_mut Sep 13, 2023
Copy link
Member

@Centri3 Centri3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just two nits. Looks good otherwise

clippy_lints/src/needless_pass_by_ref_mut.rs Outdated Show resolved Hide resolved
clippy_lints/src/needless_pass_by_ref_mut.rs Show resolved Hide resolved
…sync functions right besides other closures handling.

Add doc comment explaining what `MutablyUsedVariablesCtxt::prev_move_to_closure` is about.
@GuillaumeGomez
Copy link
Member Author

Applied your suggestions @Centri3.

@Centri3
Copy link
Member

Centri3 commented Sep 20, 2023

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Sep 20, 2023

📌 Commit b8b420c has been approved by Centri3

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Sep 20, 2023

⌛ Testing commit b8b420c with merge ece3878...

@bors
Copy link
Contributor

bors commented Sep 20, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Centri3
Pushing ece3878 to master...

@bors bors merged commit ece3878 into rust-lang:master Sep 20, 2023
4 checks passed
@GuillaumeGomez GuillaumeGomez deleted the async-fn-returned-closure branch September 20, 2023 08:39
@fasterthanlime
Copy link

Still seeing this on 2023-09-21, I guess the nightly build happened before the merge? I'm always unclear on what the exact timing is there.

@Centri3
Copy link
Member

Centri3 commented Sep 21, 2023

Sync hasn't happened yet, last one was rust-lang/rust#115790. It's biweekly so it'll be a few days until it's in nightly.

wbinnssmith added a commit to vercel/turborepo that referenced this pull request Oct 6, 2023
This:
- Updates rust-toolchain to nightly-2023-10-06
- Removes allowing clippy rules for needless_pass_by_ref_mut and non_canonical_partial_ord_impl as the linked issues appear to have been resolved in [0] and [1] respectively
- Fixes apparently legitimate issues now reported by clippy

Test Plan: CI

[0] rust-lang/rust-clippy#11492
[1] rust-lang/rust-clippy#11188
wbinnssmith added a commit to vercel/turborepo that referenced this pull request Oct 10, 2023
This:
- Updates rust-toolchain to nightly-2023-10-06
- Removes allowing clippy rules for needless_pass_by_ref_mut and
non_canonical_partial_ord_impl as the linked issues appear to have been
resolved in [0] and [1] respectively
- Fixes apparently legitimate issues now reported by clippy

Test Plan: CI

[0] rust-lang/rust-clippy#11492
[1] rust-lang/rust-clippy#11188


Closes WEB-1732
Zertsov pushed a commit to vercel/turborepo that referenced this pull request Oct 11, 2023
This:
- Updates rust-toolchain to nightly-2023-10-06
- Removes allowing clippy rules for needless_pass_by_ref_mut and
non_canonical_partial_ord_impl as the linked issues appear to have been
resolved in [0] and [1] respectively
- Fixes apparently legitimate issues now reported by clippy

Test Plan: CI

[0] rust-lang/rust-clippy#11492
[1] rust-lang/rust-clippy#11188


Closes WEB-1732
@conradludgate
Copy link

Hi, this issue exists on the beta build currently. Can we get this fix backported?

ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 25, 2024
This:
- Updates rust-toolchain to nightly-2023-10-06
- Removes allowing clippy rules for needless_pass_by_ref_mut and
non_canonical_partial_ord_impl as the linked issues appear to have been
resolved in [0] and [1] respectively
- Fixes apparently legitimate issues now reported by clippy

Test Plan: CI

[0] rust-lang/rust-clippy#11492
[1] rust-lang/rust-clippy#11188


Closes WEB-1732
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
This:
- Updates rust-toolchain to nightly-2023-10-06
- Removes allowing clippy rules for needless_pass_by_ref_mut and
non_canonical_partial_ord_impl as the linked issues appear to have been
resolved in [0] and [1] respectively
- Fixes apparently legitimate issues now reported by clippy

Test Plan: CI

[0] rust-lang/rust-clippy#11492
[1] rust-lang/rust-clippy#11188


Closes WEB-1732
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
This:
- Updates rust-toolchain to nightly-2023-10-06
- Removes allowing clippy rules for needless_pass_by_ref_mut and
non_canonical_partial_ord_impl as the linked issues appear to have been
resolved in [0] and [1] respectively
- Fixes apparently legitimate issues now reported by clippy

Test Plan: CI

[0] rust-lang/rust-clippy#11492
[1] rust-lang/rust-clippy#11188


Closes WEB-1732
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

needless_pass_by_ref_mut false positive in closure in async
6 participants